PROGRAM GMAPS
USE POLYMORPHIC_COMPLEXTAYLOR
IMPLICIT NONE
TYPE(GMAP) EQ
TYPE(TAYLOR) X(2)
REAL(DP) SOL(2),DSOL(2),eval(2),p
INTEGER I,j(4),more,no

Write(6,*) " no >= 1 " 
read(5,*) no

CALL INIT(NO,3)    

CALL ALLOC(EQ,2);CALL ALLOC(X);


SOL=0.D0
eval=0.D0
100 CONTINUE

X(1)=SOL(1)+(1.D0.MONO.1)
X(2)=SOL(2)+(1.D0.MONO.2)
p=5.D0

! Parameter dependent Equation
EQ%V(1)= 2.D0*X(1)+1.D-2*X(2)**2 + 1.D-1*X(1)*X(2) -10.D0 + 0.1d0 *(1.d0.mono.'001') 
EQ%V(2)= 5.D0*X(2)+1.D-2*X(2)**2 +0.1D0*SIN(X(1)*X(2)**2)-10.D0 

X(1)=EVAL(1)+(1.D0.MONO.1)
X(2)=EVAL(2)+(1.D0.MONO.2)

EQ=EQ.OO.(-1)

DSOL=EQ
x(1)=eq%v(1).par.'00'
x(2)=eq%v(2).par.'00'
call print(x(1),6)
call print(x(2),6)
! set third parameter to p
eval=sol(1:2)
j=0
do i=1,c_%no
j(3)=i
eval(1)=eval(1)+(x(1).sub.j)*p**j(3)
eval(2)=eval(2)+(x(2).sub.j)*p**j(3)
enddo
! eval now contains the approximate solution for p = 5.d0

SOL=SOL+DSOL

WRITE(6,*) " SOLUTIONS ARE NOW : "
WRITE(6,*) SOL(1:2)
WRITE(6,*) " SOLUTIONS ARE NOW FOR P =  : ",p
WRITE(6,*) eval(1:2)

WRITE(6,*) " CHECKING THE SOLUTIONS FOR P=0 ARE : "

WRITE(6,*) 2.D0*SOL(1)-10.D0 +1.D-2*SOL(2)**2  + 1.D-1*SOL(1)*SOL(2)
WRITE(6,*) 5.D0*SOL(2)-10.D0  +1.D-2*SOL(2)**2 +0.1D0*SIN(SOL(1)*SOL(2)**2)

write(6,*) " More iterations enter 1, Check p-dependent solution  enter 0"
read(5,*) more
if(more==1) goto 100
CALL KILL(EQ);CALL KILL(X);


CALL INIT(NO,2)    

CALL ALLOC(EQ,2);CALL ALLOC(X);


SOL=eval
eval=0.d0
101 CONTINUE

X(1)=SOL(1)+(1.D0.MONO.1)
X(2)=SOL(2)+(1.D0.MONO.2)

EQ%V(1)= 2.D0*X(1)-10.D0 +1.D-2*X(2)**2  + 1.D-1*X(1)*X(2)   + 0.1d0  *p
EQ%V(2)=  5.D0*X(2)-10.D0  +1.D-2*X(2)**2  +0.1D0*SIN(X(1)*X(2)**2)



EQ=EQ.OO.(-1)

DSOL=EQ

SOL=SOL+DSOL

WRITE(6,*) " SOLUTIONS ARE NOW : "
WRITE(6,*) SOL(1:2)

WRITE(6,*) " CHECKING THE SOLUTIONS ARE : "

WRITE(6,*) 2.D0*SOL(1)-10.D0 +1.D-2*SOL(2)**2  + 1.D-1*SOL(1)*SOL(2) + 0.1d0  *p
WRITE(6,*) 5.D0*SOL(2)-10.D0  +1.D-2*SOL(2)**2 +0.1D0*SIN(SOL(1)*SOL(2)**2)

write(6,*) " More iterations enter 1"
read(5,*) more
if(more==1) goto 101
CALL KILL(EQ);CALL KILL(X);


END PROGRAM GMAPS

